import axios from 'axios';
import { defineStore} from 'pinia'
import { Channel } from '../../types/data';
export default defineStore('channel', {
    state:() => {
        return {
            curId:2,
            list:[] as Channel
        }
    },
    actions: {
      setCurId(id:number){
        this.curId = id
      },
      async getChannelList(){
        // console.log('getChannelList');
        const res = await axios.get<{data:{ channels:Channel},message:string} >('http://geek.itheima.net/v1_0/channels')
        // console.log(res.data.data.channels);
        this.list = res.data.data.channels
      }
    }
})